<?php
namespace BP\GPM;
require_once("BP/Web/WebUser.php");
class BarEmps extends EntitiesMyPK {
	public static function constructor__ () 
	{
		$me = new self();
		return $me;
	}
	public function getNewEntity () 
	{
		return BarEmp::constructor__();
	}
	public function InitMyBars () 
	{
		$bars = Bars::constructor__();
		$bars->RetrieveAll();
		foreach ($bars->ToJavaList() as $b) 		{
			$be = BarEmp::constructor__();
			$be->setMyPK((($b->getNo() . "_") . $WebUser->getNo()));
			if (($be->RetrieveFromDBSources() == 1))
			{
				continue;
			}
			$be->setFK_Bar($b->getNo());
			$be->setFK_Emp($WebUser->getNo());
			$be->setIsShow( TRUE );
			$be->setTitle($b->getName());
			$be->Insert();
		}
		return "执行成功";
	}
	public function ToJavaList () 
	{
		return $this;
	}
	public function Tolist () 
	{
		$list = [];// 
		for ($i = 0; ($i < $this->size()); ++$i) 
		{
			$list->add($this->get($i));
		}
		return $list;
	}
}
?>
